<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新手指引</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/driver.js@1.0.1/dist/driver.css"/>
</head>
<body>
<h1 id="h1">新手指引</h1>
<h2 id="sb1">第一步</h2>
<p>
    随机文字随机文字随机文字随机文字随机文字随机文字随机文字随机文字，<br>
    随机文字随机文字随机文字随机文字随机文字随机文字随机文字随机文字，<br>
    随机文字随机文字随机文字随机文字随机文字随机文字随机文字随机文字，<br>
    随机文字随机文字随机文字随机文字随机文字随机文字随机文字随机文字，<br>
    随机文字随机文字随机文字随机文字随机文字随机文字随机文字随机文字，<br>
    随机文字随机文字随机文字随机文字随机文字随机文字随机文字随机文字，<br>
</p>
<h2 id="sb2">第二步</h2>
<p>
    肚子饿了，晚上没吃饭，<br>
    肚子饿了，晚上没吃饭，<br>
    肚子饿了，晚上没吃饭，<br>
    肚子饿了，晚上没吃饭，<br>
    肚子饿了，晚上没吃饭，<br>
    肚子饿了，晚上没吃饭，<br>
    肚子饿了，晚上没吃饭，<br>
</p>
<h2 id="sb3">第三步</h2>
<p>
    晚上要去吃点夜宵，<br>
    晚上要去吃点夜宵，<br>
    晚上要去吃点夜宵，<br>
    晚上要去吃点夜宵，<br>
    晚上要去吃点夜宵，<br>
    晚上要去吃点夜宵，<br>
</p>

<script src="https://cdn.jsdelivr.net/npm/driver.js@1.0.1/dist/driver.js.iife.js"></script>
<script>
    const driver = window.driver.js.driver;

    const driverObj = driver({
        showProgress: true,
        allowClose: false,
        steps: [
            { element: '#sb1', popover: { title: '万事开头难', description: '大胆跨出第一步', side: "bottom", align: 'start' }},
            { element: '#sb2', popover: { title: 'Import the Library', description: 'It works the same in vanilla JavaScript as well as frameworks.', side: "bottom", align: 'start' }},
            { element: '#sb3', popover: { title: 'Importing CSS', description: 'Import the CSS which gives you the default styling for popover and overlay.', side: "top", align: 'start' }},
            { popover: { title: 'Happy Coding', description: 'And that is all, go ahead and start adding tours to your applications.' } }
        ],
        // onDestroyStarted is called when the user tries to exit the tour
        onDestroyStarted: () => {
            if (!driverObj.hasNextStep() || confirm("Are you sure?")) {
                driverObj.destroy();
            }
        },
        onDestroyed: () => {
            console.log("driverObj closed!")
        }
    });

    driverObj.drive();
</script>
</body>
</html>